package com.abigdreamer.im.client.module.network.handler;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;

import com.abigdreamer.im.client.module.network.socket.ConnectSession;
import com.abigdreamer.im.client.module.talk.cinema.ClientReceivedMessageProcessManager;
import com.abigdreamer.im.client.util.EIMLogger;
import com.abigdreamer.im.message.BaseMessage;

/**
 *
 */
public class ClientFileHandler extends IoHandlerAdapter {

	public void messageReceived(IoSession ioSession, Object message) throws Exception {
		BaseMessage basemessage = (BaseMessage) message;
		EIMLogger.INFO("接受到得消息为：" + message);
		ClientReceivedMessageProcessManager.processMessage(basemessage);
	}

	public void sessionOpened(IoSession ioSession) throws Exception {
		ConnectSession clientConnect = ConnectSession.getInstance();
		EIMLogger.INFO("会话已经打开");
		clientConnect.setFileSession(ioSession);
	}

}
